const express = require('express');
const ejs = require('ejs');
const expressSession = require('express-session');
const app = express();

const pageRouter= require('./routers/pageRouter')
const apiRouter= require('./routers/apiRouter')

// 获取解析post请求发送来的请求体数据
app.use(express.urlencoded({extended:false}));

app.listen(80,()=>{
    console.log("80启动成功");
});
// 配置模板引擎
app.engine('html',ejs.renderFile);
app.use(expressSession({
    name:"s_id",
    secret:"230215",
    saveUninitialized:false,
    resave:true,
    cookie:{
        httpOnly:true,
        maxAge:1000*60*60*24*30
    }
}))

app.use(pageRouter)
app.use(apiRouter)
